﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLLTZS.Funcionalidad;

namespace TZS.Ofertas
{
    public partial class MisFavoritos : FormGenerico
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ParametroNombreUsuario = User.Identity.Name;
        }

        protected void btnQuitarFavorito_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            int idOferta = int.Parse(btn.CommandArgument);

            BLLFavorito bll = new BLLFavorito();

            if (bll.EsFavorito(idOferta, User.Identity.Name))
            {
                bll.RemoverFavorito(idOferta, User.Identity.Name);
                bll.GuardarCambios();
            }

            gvMisFavoritos.DataBind();
        }
    }
}